<template>
  <div class="container is-scroll-bar" >
    <div
      class="main-content is-scroll-bar"
      style="flex-direction: column; display: flex; "
    >
      <div class="header-container">
        <el-menu
          :default-active="activeIndex"
          mode="horizontal"
          @select="handleSelect"
          class="title"
          style="width: 100%"
        >
          <el-menu-item index="1"> 上级检查 </el-menu-item>
          <el-submenu index="2">
            <template slot="title">企业自查</template>
            <el-menu-item index="2-1">显示企业的隐患排查制度</el-menu-item>
            <el-menu-item index="2-2">隐患排查要求</el-menu-item>
            <el-menu-item index="2-3">日常检查清单</el-menu-item>
            <el-menu-item index="2-4">岗位为类别的检查表</el-menu-item>
            <el-menu-item index="2-5">专项检查清单</el-menu-item>
            <el-menu-item index="2-6">隐患排查情况表</el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">隐患整改</template>
            <el-menu-item index="3-1">通知单</el-menu-item>
            <el-menu-item index="3-2">台账</el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">重大事故隐患专项</template>
            <el-menu-item index="4-1">导入</el-menu-item>
            <el-menu-item index="4-2">煤矿重大隐患排查表</el-menu-item>
            <el-menu-item index="4-4"
              >金属非金属地下矿山重大隐患排查表</el-menu-item
            >
            <el-menu-item index="4-5"
              >金属非金属露天矿山重大隐患排查表</el-menu-item
            >
            <el-menu-item index="4-6">尾矿库重大隐患排查表</el-menu-item>
            <el-menu-item index="4-7"
              >危险化学品经营单位重大隐患排查表</el-menu-item
            >
            <el-menu-item index="4-8"
              >烟花爆竹生产经营单位重大隐患排查表</el-menu-item
            >
            <el-menu-item index="4-9">工贸企业重大隐患排查表</el-menu-item>
            <el-menu-item index="4-10"
              >房屋市政工程生产经营单位重大隐患排查表</el-menu-item
            >
            <el-menu-item index="4-3">重大事故隐患台账</el-menu-item>
          </el-submenu>
          <el-submenu index="5">
            <template slot="title">其它专项</template>
            <el-menu-item index="5-1">上传排查方案或工作方案</el-menu-item>
            <el-menu-item index="5-2">上传整改方案</el-menu-item>
            <el-menu-item index="5-2">上传整改验收</el-menu-item>
          </el-submenu>
        </el-menu>
      </div>
      <div class="main">
        <transition name="fade-right" mode="out-in">
          <router-view></router-view>
        </transition>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineComponent, ref } from "vue";
import router from "@/router";
const props = defineProps();
const message = "Hello, Vue 3!";
const activeIndex = ref("1");
const NewComponentName = defineComponent({
  name: "SafetyManagementIndex",
  setup() {
    return {
      message,
    };
  },
});

console.log(props);
console.log(NewComponentName);

const handleSelect = (key, keyPath) => {
  console.log(key, keyPath);
  if (key == "1") {
    if (router.currentRoute.path !== "/hiddendangerinvestigation") {
      router.push("/hiddendangerinvestigation");
    }
  } else if (key == "2-1") {
    if (router.currentRoute.path !== "/hiddendangerinvestigationsystem") {
      router.push("/hiddendangerinvestigationsystem");
    }
  } else if (key == "2-2") {
    if (router.currentRoute.path !== "/investigationrequirements") {
      router.push("/investigationrequirements");
    }
  } else if (key == "2-3") {
    if (router.currentRoute.path !== "/dailychecklist") {
      router.push("/dailychecklist");
    }
  } else if (key == "2-4") {
    if (router.currentRoute.path !== "/category") {
      router.push("/category");
    }
  } else if (key == "2-5") {
    if (router.currentRoute.path !== "/specialchecklists") {
      router.push("/specialchecklists");
    }
  } else if (key == "2-6") {
    if (router.currentRoute.path !== "/investigationtable") {
      router.push("/investigationtable");
    }
  } else if (key == "3-1") {
    if (router.currentRoute.path !== "/notices") {
      router.push("/notices");
    }
  } else if (key == "3-2") {
    if (router.currentRoute.path !== "/ledger") {
      router.push("/ledger");
    }
  } else if (key == "4-1") {
    if (router.currentRoute.path !== "/introducehiddendangers") {
      router.push("/introducehiddendangers");
    }
  } else if (key == "4-2") {
    if (router.currentRoute.path !== "/hazardinvestigationform") {
      router.push("/hazardinvestigationform");
    }
  } else if (key == "4-3") {
    if (router.currentRoute.path !== "/hiddendangerledger") {
      router.push("/hiddendangerledger");
    }
  } else if (key == "4-4") {
    if (router.currentRoute.path !== "/tow") {
      router.push("/tow");
    }
  } else if (key == "4-5") {
    if (router.currentRoute.path !== "/three") {
      router.push("/three");
    }
  } else if (key == "4-6") {
    if (router.currentRoute.path !== "/four") {
      router.push("/four");
    }
  } else if (key == "4-7") {
    if (router.currentRoute.path !== "/five") {
      router.push("/five");
    }
  } else if (key == "4-8") {
    if (router.currentRoute.path !== "/six") {
      router.push("/six");
    }
  } else if (key == "4-9") {
    if (router.currentRoute.path !== "/seven") {
      router.push("/seven");
    }
  } else if (key == "4-10") {
    if (router.currentRoute.path !== "/eight") {
      router.push("/eight");
    }
  } else if (key == "5-1" || key == "5-2" || key == "5-3") {
    if (router.currentRoute.path !== "/programmework") {
      router.push("/programmework");
    }
  }
  //   else if (key == 3) {
  //     if (router.currentRoute.path !== "/safetyoperatingprocedures") {
  //       router.push("/safetyoperatingprocedures");
  //     }
  //   } else if (key == "3-1") {
  //     if (router.currentRoute.path !== "/corporateproductionresponsibility") {
  //       router.push("/corporateproductionresponsibility");
  //     }
  //   } else if (key == "3-2") {
  //     if (router.currentRoute.path !== "/productionpostresponsibilities") {
  //       router.push("/productionpostresponsibilities");
  //     }
  //   } else if (key == "3-3") {
  //     if (router.currentRoute.path !== "/institutionalsystem") {
  //       router.push("/institutionalsystem");
  //     }
  //   } else if (key == "3-4") {
  //     if (router.currentRoute.path !== "/riskidentification") {
  //       router.push("/riskidentification");
  //     }
  //   } else if (key == "3-5") {
  //     if (router.currentRoute.path !== "/jobprocedures") {
  //       router.push("/jobprocedures");
  //     }
  //   } else if (key == "3-6") {
  //     if (router.currentRoute.path !== "/dailysecuritychecks") {
  //       router.push("/dailysecuritychecks");
  //     }
  //   } else if (key == "3-7") {
  //     if (router.currentRoute.path !== "/emergencysupportsystem") {
  //       router.push("/emergencysupportsystem");
  //     }
  //   } else if (key == "3-8") {
  //     if (router.currentRoute.path !== "/outsourcedprojectmanagement") {
  //       router.push("/outsourcedprojectmanagement");
  //     }
  //   }
};
</script>

<style lang="scss" scoped>
:deep(.main) {
  height: 100%;
}
:deep(.el-menu--horizontal > .el-submenu .el-submenu__title) {
  height: 54px;
  line-height: 54px;
}
.fade-right-enter-active,
.fade-right-leave-active {
  transition: opacity 0.1s;
}
.fade-right-enter,
.fade-right-leave-to {
  opacity: 0;
}

body {
  min-height: 100vh;

  transition: all 0.3s ease;
}
.container {
  padding: 15px;
  box-sizing: border-box;

  .main-content {
    background-color: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    min-width: 700px;
    .header-container {
      padding: 15px 15px;
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      .title {
        position: relative;
        font-weight: bold;
        color: #333;
        font-size: 15px;
        padding-left: 16px;

        &::before {
          content: "";
          width: 3px;
          height: 19px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 19px);
          position: absolute;
        }

        &::after {
          content: "";
          width: 3px;
          height: 16px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 8px);
          position: absolute;
        }
      }
    }
  }
}

.main {
  padding: 12px 15px;
}

.w-100 {
  width: 100%;
}

.item-form-content {
  display: flex;
  flex-direction: row;
  align-items: center;

  i {
    margin: 0 10px;
  }
}

.productList-content {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  height: 40px;
}

.form-content {
  padding: 0 10px;
}

.dialog-action-bar {
  text-align: center;
  margin-top: 30px;
}
</style>
